import React, { useState, useEffect } from 'react'
import Taro from "@tarojs/taro";
import { useRouter, useDidShow } from '@tarojs/taro'
import { View, WebView } from '@tarojs/components'

export default () => {
    const { params: { goToWebViewUrl, WebViewTitle } } = useRouter();
    const [url, setUrl] = useState('')
    const [title, setTitle] = useState('')
    useDidShow(() => {
        console.log("paramsData", goToWebViewUrl);
        console.log(goToWebViewUrl);
        setUrl(goToWebViewUrl)
        setTitle(WebViewTitle)
    })
    useEffect(() => {
        Taro.setNavigationBarTitle({ title: title });
    }, [title]);
    return <View><WebView src={url} /></View>
}